package com.itheima.work1121;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class ThreeCountry {
    public static void main(String[] args) {
        List<String> date = Arrays.asList(
                "刘备字玄德", "诸葛亮字孔明", "曹操字孟德", "孙权字仲谋",
                "关羽字云长", "张飞字翼德", "赵云字子龙", "乐进字文谦",
                "李典字曼成", "曹仁字子孝", "曹洪字子廉"
        );
//        System.out.println(date);
        Map<String, String> namerozi = date.stream().map(s -> s.split("字"))
                .collect(Collectors
                        .toMap(arr -> arr[0], arr -> arr[1]));

        namerozi.forEach((name,zi)->{
            System.out.print(name + "~" + zi + " ");
        });
    }
}
